/**
 * ULoadingDialog组件
 * @class ULoadingDialog
 * @extends Basic
 * 示例:
 *
 *     @example
 *     ULoadingDialog.show();
 * */
window.ULoadingDialog = (function(){
	var ele;
	var isShowing = false;
    var msgArea = document.createElement('div');
    document.body.appendChild(msgArea);

    var LoadingDialog = React.createClass({
        render:function(){
            return (
                <div>
                    <div className="ucs-loading-background">

                    </div>
                    <div className="ucs-loading">
                        <img src="../content/images/loading.gif" alt="" />
                    </div>
                </div>

            )
        }
    });
    var _show = function(){
    		if(isShowing){
    			return;
    		}
    		isShowing = true;
    		ele = <LoadingDialog/>;
    		ReactDOM.render(ele,msgArea);
    }
    var _hide = function(){
    		if(ele != undefined){
    			isShowing = false;
    			msgArea.innerHTML='';
    			return;
    		}
    }
    return {
        show:_show,
        hide:_hide
    }
})();

module.exports = ULoadingDialog;